package com.banana.manager.forest.controller.info;

import com.banana.manager.forest.entity.info.PestBean;
import com.banana.manager.forest.service.impl.info.PestServiceImpl;
import com.github.pagehelper.PageInfo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/pest")
public class PestController {

    @Resource
    private PestServiceImpl pestService;


    @PostMapping("/addPest")
    public PestBean addPest(@RequestBody PestBean pestBean){
       return pestService.addPest(pestBean);
    }

    @GetMapping("/showPest")
    public PestBean getOnePest(Integer pestId){
        return pestService.findOneById(pestId);
    }

    @GetMapping("/displayPest")
    public PageInfo<PestBean> getPestsPage(Integer page,String pestName, String pestHost){
        return pestService.findBlurByPage(page, pestName, pestHost);
    }
}
